package com.zy.advice;



import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @author LittleDesire
 * @description 环绕通知  可以修改返回值结果
 * @date 2022-04-06 周三 17:03
 * @since 17
 */
public class MyMethodInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("之前");
        Object o = invocation.proceed();
        System.out.println("之后");
        if (o != null && o instanceof String){
            return ((String) o).toUpperCase();
        }
        return o;
    }
}
